package com.lyx.liaicodemotherbackend.service;

import com.lyx.liaicodemotherbackend.model.entity.User;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.service.IService;
import com.lyx.liaicodemotherbackend.model.dto.app.AppQueryRequest;
import com.lyx.liaicodemotherbackend.model.entity.App;
import com.lyx.liaicodemotherbackend.model.vo.AppVO;
import reactor.core.publisher.Flux;

import java.io.Serializable;
import java.util.List;

/**
 * 应用 服务层。

 */
public interface AppService extends IService<App> {

    /**
     * 获取应用封装类
     *
     * @param app
     * @return
     */
    AppVO getAppVO(App app);

    /**
     * 获取应用封装类列表
     *
     * @param appList
     * @return
     */
    List<AppVO> getAppVOList(List<App> appList);

    /**
     * 构造应用查询条件
     *
     * @param appQueryRequest
     * @return
     */
    QueryWrapper getQueryWrapper(AppQueryRequest appQueryRequest);


    /**
     * 通过聊天生成应用
     *
     * @param appId
     * @param message
     * @param loginUser
     * @return reactor.core.publisher.Flux<java.lang.String>
     * @author lyx
     * @create 2025/11/22
     **/
    Flux<String>chatToGenCode(Long appId, String message, User loginUser);

    /**
     * 应用部署
     *
     * @param appId
     * @param loginUser
     * @return java.lang.String
     * @author lyx
     * @create 2025/11/22
     **/
    String deployApp(Long appId, User loginUser);

    /**
     * 删除应用时关联对话历史
     *
     * @param id 应用ID
     * @return 是否成功
     * @author lyx
     * @create 2025/11/25
     **/
    boolean deleteAppWithChatHistory(Serializable id);


}
